/**
 * timer和immediate谁先执行
 */

// 跟源码的表现不太一些样
(() => console.log(0))();

setTimeout(() => {
  console.log(1);
}, 0);

setImmediate(() => {
  console.log(2);
});

// the guarantee is that setImmediate callbacks will be called before timers' callbacks only when they are scheduled within an I/O callback

// setTimeout(() => {
//   setTimeout(() => {
//     console.log(3);
//   }, 0);
  
//   setImmediate(() => {
//     console.log(4);
//   });
// }, 0);

